/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bookshop.service;

import com.bookshop.dao.IDaoCustomerOrderBookLocal;
import com.bookshop.entity.Book;
import com.bookshop.entity.CustomerorderBook;
import com.bookshop.entity.CustomerorderBookPK;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

/**
 *
 * @author Samir
 */
@Singleton(mappedName = "com.bookshop.service.CustomerorderBook")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class CustomerOrderBookService implements Serializable {

    @EJB
    private IDaoCustomerOrderBookLocal daoCustomerOrderBook;

    public void addItem(Book book,int quantity) {
        daoCustomerOrderBook.addItem(book,quantity);
    }

    public void removeItem(CustomerorderBook item) {
        daoCustomerOrderBook.removeItem(item);
    }
    
    public int getItemNumberFromCart(){
       return daoCustomerOrderBook.getItemNumberFromCart();
    }
    
    public List<CustomerorderBook> getCartItems(CustomerorderBookPK customerOrderBookPk){
        return daoCustomerOrderBook.getCartItems(customerOrderBookPk);
    }
}
